// pages/tuiKuanDingDan/tuiKuanDingDan.js
var util = require('../../utils/util.js')
const Monitor = require('../../utils/monitor.js').Monitor
Page({

  data: {
    imgUrls: getApp().globalData.imgUrls,
    pageNum:1,
    orders_list:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      status:99
    })
  },

  onShow: function () {
    this.orderList()
  },
  orderList() {
    var that = this
    util.API('pyapi/user_order_list', {
      status: that.data.status,
      page: that.data.pageNum,
      pageshow: 3,
    }, 'application/x-www-form-urlencoded').then(res => {
      let {
        code,
        orders_list,
        msg
      } = res
      if (code == 200) {
        console.log(res,123132)
        orders_list.map((item, index) => {
          let totleNum = 0
          item.goods_list.map((items) => {
            totleNum += items.nums
          })
          item.totleNum = totleNum
        })

        if (Noempty) {} else {
          that.data.list = []
        }
        that.data.list = that.data.list.concat(orders_list);
        this.setData({
          list: that.data.list
        })
      } else {
        that.setData({
          loading: true,
        })
      }
    })
  }
})